package day1102.demo02;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @program: qy158
 * @description:
 * @author: 闫克起2
 * @create: 2022-11-02 09:50
 **/
public class Test {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(5);

        for(int i=0;i<15;i++){
            executorService.submit(new Runnable() {
                @Override
                public void run() {
                        System.out.println(Thread.currentThread().getName() + "~~~~~~~~~~");
                }
            });
        }

        //关闭线程池， ---关闭所有等待的任务。
        executorService.shutdown();

        boolean shutdown = executorService.isShutdown();
        System.out.println(shutdown);

        //判断线程池是否终止----里面的任务执行完毕
        boolean b = executorService.isTerminated();
        System.out.println(b);
    }
}
